const Vue = require('vue')
Vue.use(require('vue-cookies'))
Vue.prototype.$ctx = API_CONFIG.apiDomain;
const ElementUI = require('element-ui')
require('babel-polyfill')
import router from './router/index'
import './util/ajax'
import './util/tableMixins'
import './util/extends'
import './util/resource'
import App from './MainApp.vue'
// import './assets/style.css'
import './assets/style/index.css'
import './assets/iconfont.css'
import tableMixins from './util/tableMixins'
// 重置table数据流
delete window.ELEMENT.Table.components.TableBody.computed.data;
// 添加虚拟列表逻辑
window.ELEMENT.Table.components.TableBody.mixins.push(tableMixins);
const componentContext = require.context('./components', true, /\.vue$/);
import VueContextMenu from "vue-contextmenujs";
Vue.use(VueContextMenu)

componentContext.keys().forEach((key) => {
  const component = componentContext(key).default;
  Vue.component(component.name, component);
});

import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    token:null,
    user:null,
    title:null,
    breadcrumbList:[],
  },
  mutations: {
    updateToken (state,token) {
      state.token = token;
    },
    updateUser (state,user) {
      state.user = user;
    },
    updateTitle (state,title) {
      state.title = title;
    },
    addBreadcrumb(state,data){
      state.breadcrumbList.push(data);
    },
    clearBreadcrumb(state) {
      state.breadcrumbList = [];
    },
  }
})
import systemConfig from '../config/system'
store.commit("updateTitle",systemConfig.title)

Vue.config.productionTip = false
import VueClipboard from 'vue-clipboard2'

VueClipboard.config.autoSetContainer = true // add this line
Vue.use(VueClipboard)

new Vue({
  router,
  render: h => h(App),
  store:store
}).$mount('#app')